//
//  Reranker.h
//  iornn-parser-c
//
//  Created by Phong Le on 27/12/14.
//  Copyright (c) 2014 Phong Le. All rights reserved.
//

#ifndef iornn_parser_c_Reranker_h
#define iornn_parser_c_Reranker_h

#include "Depstruct.h"
#include "Treebank.h"
#include "KBestTreebank.h"
#include "IORNN.h"
#include <string>
#include <vector>

class Reranker {
public:
    
    int* countMatches(Depstruct* testDs, Depstruct* goldDs, bool punc);
    
    real* computeScore(vector<Depstruct*> testDs, vector<Depstruct*> goldDs, bool punc);
    
    void outputFile(vector<Depstruct*> dsbank, string path, Dictionary *posDic, Dictionary *deprelDic);
    
    vector< vector<real> > computeLogprobs(IORNN *net, KBestTreebank *kbestTb);
    
    vector<Depstruct*> rerank(KBestTreebank* kbestTb, Treebank *goldTb, string type);
    
    vector<Depstruct*> rerank(vector< vector<real> > iornnscores, vector< vector<real> > pscores, int kbest, real alpha,
                              KBestTreebank* kbestTb) ;
    
    real* optimizeMixReranker(IORNN *net, Treebank *devTb, KBestTreebank *kbestDevTb);
    void parse(IORNN* net, Treebank* testTb, KBestTreebank* kbestTestTb, int kbest, real alpha, string output);
};

#endif
